package com.codefish;

/**
 * 镐子类
 *
 * @author codefish
 * @version 1.0
 * @date 2022/05/16 下午 09:02
 */
public class Pickaxe extends Tool {
    /**
     * 镐子的制造材料
     */
    String material;

    public Pickaxe(String material, String name) {
        this.material = material;
        super.name = name;
    }

    @Override
    public void use() {
        System.out.format("使用材质为%s的\"%s\",价值为%d\n", material, name, estimateValue());
    }

    @Override
    public Integer estimateValue() {
        int value;
        switch (material) {
            case "木": {
                value = 1;
                break;
            }
            case "石": {
                value = 3;
                break;
            }
            case "金": {
                value = 5;
                break;
            }
            case "铁": {
                value = 9;
                break;
            }
            case "钻石": {
                value = 20;
                break;
            }
            default:
                value = -1;
        }
        return value;
    }
}
